﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pxCourse.aspx.cs" Inherits="OnLineExam.Web.mag.pxCourse" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../jquery-easyui-1.2.5/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../jquery-easyui-1.2.5/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script src="../jquery-easyui-1.2.5/jquery-1.7.1.min.js" type="text/javascript"></script> 
    <script src="../jquery-easyui-1.2.5/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../jquery-easyui-1.2.5/locale/easyui-lang-zh_CN.js" type="text/javascript">
    </script><script src="../Scripts/jQuery.FillOptions.js" type="text/javascript"></script>
    <script src="../Scripts/uploadify/jquery.uploadify.v2.1.4.min.js" type="text/javascript"></script>
    <script src="../Scripts/uploadify/swfobject.js" type="text/javascript"></script>
    <script src="pxCourse.js" type="text/javascript"></script>
    <script>
    $(function () {
            $("#selectDep").FillOptions('GetDepInfoHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', { datatype: "json", textfield: "Name", valuefiled: "ID" });
            $("#selectClass").FillOptions('Handler/pxCourseClassHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlistForSelect&depid=<%=Umodel.DepID %>&page=1&rows=1000', { datatype: "json", textfield: "ClassName", valuefiled: "ClassID" });
            $("#selectPaper").FillOptions('Handler/PaperHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlistForSelect&depid=<%=Umodel.DepID %>&page=1&rows=1000', { datatype: "json", textfield: "PaperName", valuefiled: "PaperID" });
            $("#selectDep1").FillOptions('GetDepInfoHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', { datatype: "json", textfield: "Name", valuefiled: "ID" });
             $("#selectDep1").attr("value", '<%=Umodel.DepID %>');
            <%if (User.IsInRole("教师")){ %>
           $("#selectDep").attr("disabled", 'disabled');
          
           $("#selectDep1").attr("disabled", 'disabled');
                //$("#dd table tr").eq(0).hide();
                        //$("#selectDep").attr("disabled", 'disabled'); //默认选中disabled
                        <%} %>
            $("#Checkbox1").click(function(){
                $("#txtalowUserID").val("0,");
             });

            $("#selectDep").change(function () { 
                $("#selectClass").empty(); 
                $("#selectClass").FillOptions('Handler/pxCourseClassHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlistForSelect&depid='+$(this).val()+'&page=1&rows=1000', { datatype: "json", textfield: "ClassName", valuefiled: "ClassID" });
            });
            $("#selectDep1").change(function () { 
                
                getdata($(this).val());
            });

            $('#tt').datagrid({

                idField: 'ID',
                url: 'Handler/pxCourseHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=<%=Umodel.DepID %>', //?startIndex=0&endIndex=20  /''+ index +'/'
                singleSelect: true,
                columns: [[
                   { field: 'ID', title: '序号', width: 80 },
                  { field: 'c_title', title: '标题', width: 250 },
                  { field: 'c_startDate', title: '开始时间', width: 100 },
                  { field: 'c_endDate', title: '结束时间', width: 100 },
                  { field: 'c_type', title: '类型', width: 80 },

                  { field: 'opt', title: '操作', width: 100, align: 'center',
                      formatter: function (value, rec, index) {
                          var e = '<a href="#" mce_href="#" onclick="edit(' + rec.ID + ')">编辑</a> ';
                          var d = '<a href="#" mce_href="#" onclick="del(' + index + ')">删除</a> ';
                          return e + d;
                      }
                  }
                ]],
                toolbar: [{
                    text: '增加', iconCls: 'icon-add', handler: function () {
                    add();
                    }
                } ,
                { text: '查找', iconCls: 'icon-search' }
                ],
                pagination: true, rownumbers: true
            });
            var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
        var ASPSESSID = "<%= Session.SessionID %>"; 
            $("#File1").uploadify(
                        {
                            'uploader': '/Scripts/uploadify/uploadify.swf',
                            'fileExt': '*', 
                            'sizeLimit': 107374182,
                            'fileDesc': '请选择上传文件',
                            'script': 'Handler/HttpPostedFileHandler.ashx',
                            'buttonText': '.',
                             'buttonImg'   : '/Images/upload.png',
                            'hideButton': false,
                            'cancelImg': '/Images/cancel.png',
                            'folder': '/uploads/px',
                            'queueID': 'fileQueue',
                            'height': 32,
                            'width': 118,
                            'wmode': 'transparent',
                            'auto': false,
                            'multi': true,
                            'onComplete': function (event, ID, fileObj, response, data) {
                             if(response!='0')
                             {
                             var t = $("#txtPath").val();
                                if(t=='')
                                { t += response+'';
                                $("#txtPath").val(t);}
                                else {
                                t += ','+response;
                                $("#txtPath").val(t);
                                }
                                //alert(response);
                                return false;

                             }
                                
                            },
                            'onAllComplete': function (event, data) {
                                alert(data.filesUploaded  + ' 个文件上传成功!');
                            },
                            'onSelectOnce': function (e, data) {
                                $('#File1').uploadifySettings('scriptData', { 'ASPSESSID': ASPSESSID, 'AUTHID': auth });

                            } 
                        });
        })
    </script>
</head>
<body><select id="selectDep1" name="selectDep1" >
          <option value="全部">全部</option>
      </select>
    <table id="tt"></table>
    <div id="dd" class="easyui-dialog" style=" height:500px; width:720px;padding:5px 10px" closed="true" buttons="#dd-buttons">  
     <form id="ff" method="post">
     <input id="hdType" name="hdType" type="hidden" />
     <input id="hdID" name="hdID" type="hidden" /> 
     <input id="hdDepID" name="hdDepID" type="hidden" value='<%=Umodel.DepID %>' />
    <table width="100%">
  <tr><td>部门：</td><td>
      <select id="selectDep" name="selectDep" class="easyui-validatebox" required="true">
          <option></option>
      </select></td><td align="right">
          分类：</td><td>
      <select id="selectClass" name="selectClass" class="easyui-validatebox"  required="true">
          <option></option>
      </select></td></tr>
      <!-- -->
  <tr><td>类型：</td><td>
      <select id="selectType" name="selectType" class="easyui-validatebox" required="true">
         <option ></option>
        <option value="Office办公类文档">Office办公类文档</option>
        <option value="视频">视频</option>
          <option value="动画">动画</option>
          <option value="图片">图片</option>
      </select></td><td>
          &nbsp;</td><td>
          &nbsp;</td></tr>
  <tr><td>标题：</td><td colspan="3">
      <input id="txtTitle" name="txtTitle" type="text" class="easyui-validatebox" 
          required="true" cols="50"   rows="2" size="65" />
      &nbsp;</td></tr>
  
  <tr><td>开始日期：</td><td colspan="0">
      <input id="txtstartDate" name="txtstartDate" type="text" class="easyui-datebox"  required="true"/></td>
      <td align="right">
          结束日期:</td><td>
      <input id="txtendDate" name="txtendDate" type="text" class="easyui-datebox"  required="true"/></td></tr>
  <tr><td>学习人员：</td><td colspan="3">
      <input id="Checkbox1" name="alowUserJobType" type="checkbox" value="0" value="全部人员"/>全部人员&nbsp;&nbsp; 
      <input id="Checkbox2" name="alowUserJobType" type="checkbox" value="分部经理"/>分部经理&nbsp;&nbsp; 
      <input id="Checkbox3" name="alowUserJobType" type="checkbox" value="点部主管"/>点部主管&nbsp;&nbsp;&nbsp;&nbsp;<input id="Checkbox5" type="checkbox" value="仓管"/>仓管&nbsp;&nbsp; 
      <input id="Checkbox6" name="alowUserJobType" type="checkbox" value="收派员"/>收派员&nbsp;&nbsp; 
      <input id="Checkbox8" name="alowUserJobType" type="checkbox" value="司机"/>司机<br />
      <input id="Checkbox4" name="alowUserJobType" type="checkbox" value="储备干部"/>储备干部&nbsp;&nbsp; 
      <input id="Checkbox7" name="alowUserJobType" type="checkbox" value="职能三线"/>职能三线&nbsp;&nbsp; 
      <input id="Checkbox9" name="alowUserJobType" type="checkbox" />综合文员&nbsp;&nbsp;&nbsp;&nbsp;
      <input id="Checkbox10" name="alowUserJobType" type="checkbox" value="出纳"/>出纳<br />
      <textarea id="txtalowUserID" cols="45" name="txtalowUserID" rows="5" class="easyui-validatebox" required="true"></textarea><input 
          id="txtempid" name="txtempid" type="text" /><a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="addempid()">添加</a><br />
      手动输入，格式：190194,188988</td></tr>
  <tr><td>内容：</td><td colspan="3">
      <textarea id="txtContent" cols="65" name="txtContent" rows="2" class="easyui-validatebox" required="true"></textarea></td></tr>
      <tr><td>关联试卷：</td><td colspan="3">
           <select id="selectPaper" name="selectPaper" class="easyui-validatebox" required="true">
          <option></option>
      </select></td></tr>
  <tr><td>上传课件：</td><td colspan="3">
      <textarea id="txtPath" cols="65" 
          name="txtPath" rows="2" class="easyui-validatebox" required="true"></textarea><br />
         <fieldset style="font-size: 12px; width: 500px; height: 300px;">
        <br />
        <legend>上传文件区</legend>
        <div id="Two">
            <input type="file" name="File1" id="File1" />
            <div >
               <a class="easyui-linkbutton" href="javascript:$('#File1').uploadifyUpload()" iconcls="icon-ok" onclick="">开始上传</a>&nbsp;
      <a class="easyui-linkbutton" href="javascript:$('#File1').uploadifyClearQueue()" iconcls="icon-ok" onclick="">取消上传</a></div>
        </div>
        <input type="hidden" id="hidJian"  />
        <div style="overflow-y: scroll; height: 200px; width: 484px; overflow-y: scroll;">
            <div id="fileQueue">
            </div>
        </div>
    </fieldset>
          &nbsp;<br />
      </td></tr>
  <tr><td>&nbsp;</td><td colspan="3">
           &nbsp;</td></tr>
  </table>
  </form>
</div>
<div id="dd-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">保存</a>

		<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dd').dialog('close')">取消</a>

	</div>

 
</body>
</html>
<script >
    function getdata(depid) {
       
        $('#tt').datagrid({

            idField: 'ID',
            url: 'Handler/pxCourseHandler.ashx?c=' + new Date().getMilliseconds() + '&type=getlist&depid=' + depid, //?startIndex=0&endIndex=20  /''+ index +'/'
            singleSelect: true,
            columns: [[
                   { field: 'ID', title: '序号', width: 80 },
                  { field: 'c_title', title: '标题', width: 250 },
                  { field: 'c_startDate', title: '开始时间', width: 100 },
                  { field: 'c_endDate', title: '结束时间', width: 100 },
                  { field: 'c_type', title: '类型', width: 80 },

                  { field: 'opt', title: '操作', width: 100, align: 'center',
                      formatter: function (value, rec, index) {
                          var e = '<a href="#" mce_href="#" onclick="edit(' + rec.ID + ')">编辑</a> ';
                          var d = '<a href="#" mce_href="#" onclick="del(' + index + ')">删除</a> ';
                          return e + d;
                      }
                  }
                ]],
            toolbar: [{
                text: '增加', iconCls: 'icon-add', handler: function () {
                    add();
                }
            },
                { text: '查找', iconCls: 'icon-search' }
                ],
            pagination: true, rownumbers: true
        });
        //$('#tt').datagrid('reload');
    }
</script>